package com.zelix;

import java.io.File;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.StringTokenizer;

public class ZKMStackTraceTranslate {

    public static final String TRANSLATE_JAR = z(z("FZRi0}\177lQ#ht1W#n"));
    private static final String d = System.getProperty(z(z("pxqXloto\\0}epO")), "\n");
    private static final String e = System.getProperty(z(z("lpkUloto\\0}epO")));
    private String a;
    private String b;
    private uq c;
    public static final int NO_PARAM_TYPES = 1;
    public static final int UNQUALIFIED_PARAM_TYPES = 2;
    public static final int FULL_PARAM_TYPES = 3;
    static Class f; /* synthetic field */
    private static String z[];

    public ZKMStackTraceTranslate(String s) {
        this(s, null);
    }

    public ZKMStackTraceTranslate(String s, String s1) {
        super();
        wu wu1;
        label0:
        {
            label1:
            {
                int i = rb.a;

                if (s == null)
                    throw new IllegalArgumentException(z[1]);
                a = s;
                b = s1;
                wu1 = null;
                if (s1 == null || s1.length() <= 0)
                    break label0;
                if (zo.c(s1))
                    break label1;
                fv fv1 = new fv();
                String s2 = zo.a(fv1);
                if (fv1.a()) {
                    if (s1 == null || s1.length() == 0) {
                        s1 = s2;
                        if (i == 0)
                            break label1;
                    }
                    s1 = s1 + zo.c + s2;
                    if (i == 0)
                        break label1;
                }
                if (s1 == null || s1.length() == 0)
                    s1 = zo.h;
            }
            wu1 = new wu(s1);
        }
        c = new uq(s, wu1);
    }

    static Class a(String s) {
        try {
            return Class.forName(s);
        }
        catch (ClassNotFoundException classnotfoundexception) {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
    }

    public void close() {
        if (c != null)
            c.b();
    }

    public String getOldClassName(String s) {
        String s1;
        try {
            s1 = c.a(s);
        }
        catch (rb rb1) {
            s1 = z[2] + rb1.getMessage() + "\"" + d;
        }
        return s1;
    }

    public String getOldMethodSignatures(String s, String s1) {
        int j = rb.a;
        String as[];
        StringBuffer stringbuffer;
        int i;
        String s2;
        try {
            as = c.a(s, s1);
            stringbuffer = new StringBuffer();
            stringbuffer.append("[");
            i = 0;
            for (; i < as.length; i++) {
                stringbuffer.append(as[i]);
                if (i < as.length - 2) {
                    stringbuffer.append(z[18]);
//            if(j == 0)
//                continue; /* Loop/switch isn't completed */
                }
                if (i < as.length - 1)
                    stringbuffer.append(z[19]);
            }
            stringbuffer.append("]");
            s2 = stringbuffer.toString();
        } catch (rb rb1) {
            s2 = z[17] + rb1.getMessage() + "\"" + d;
        }
        return s2;
    }

    public String getTranslatedStackTrace(String s) {
        return getTranslatedStackTrace(s, true, 2);
    }

    public String getTranslatedStackTrace(String s, boolean flag) {
        return getTranslatedStackTrace(s, flag, 2);
    }

    public String getTranslatedStackTrace(String s, boolean flag, int i) {
        String s1;
        try {
            s1 = c.a(s, flag, i);
        }
        catch (rb rb1) {
            s1 = z[0] + rb1.getMessage() + "\"" + d;
        }
        return s1;
    }

    private static boolean b(String s) {
        StringTokenizer stringtokenizer;
        int i;
        i = rb.a;
        stringtokenizer = new StringTokenizer(s, e);
        while (stringtokenizer.hasMoreTokens()) {
            String s1 = stringtokenizer.nextToken();
            if (s1.endsWith(TRANSLATE_JAR)) {
                File file = new File(s1);
                if (file.exists())
                    return true;
            }
        }
        return false;
    }

    public static void main(String args[])
            throws Exception {
        a();
    }

    private static void a() {
        label0:
        {
            int i = rb.a;
            try {
                Class.forName(z[3]);
            }
            catch (ClassNotFoundException _ex) {
                System.err.println(d + z[11] + d);
                return;
            }
            try {
                Class aclass[] = new Class[0];
                Method method = (f == null ? (f = a(z[4])) : f).getMethod("b", aclass);
                method.invoke(null, null);
                break label0;
            }
            catch (IllegalAccessException illegalaccessexception) {
                System.err.println(d + z[13] + z[16] + d);
                break label0;
            }
            catch (NoClassDefFoundError noclassdeffounderror) {
                String s;
                label1:
                {
                    s = System.getProperty(z[9]);
                    if (s != null) {
                        if (s.indexOf(TRANSLATE_JAR) == -1) {
                            System.err.println(z[15]);
                            if (i == 0)
                                break label1;
                        }
                        if (b(s)) {
                            System.err.println(d + z[8] + z[16] + d);
                            if (i == 0)
                                break label1;
                        }
                        System.err.println(z[10]);
                        if (i == 0)
                            break label1;
                    }
                    System.err.println(z[12]);
                }
                System.err.println(z[5] + s + "\"");
                break label0;
            }
            catch (InvocationTargetException invocationtargetexception) {
                Throwable throwable1 = invocationtargetexception.getTargetException();
                System.err.println(d + z[7] + z[16] + d);
                throwable1.printStackTrace(System.err);
                break label0;
            }
            catch (NoSuchMethodException nosuchmethodexception) {
                System.err.println(d + z[14] + z[16] + d);
                break label0;
            }
            catch (Throwable throwable) {
                System.err.println(d + z[6] + z[16] + d);
                throwable.printStackTrace(System.err);
            }
        }
    }

    private static char[] z(String s) {
        char ac[] = s.toCharArray();
        int clen = ac.length;
        if (clen >= 2)
            return ac;
        ac[0] ^= 0x42;
        return ac;
    }

    private static String z(char ac[]) {
        for (int i = 0; i < ac.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key = 0x1c;
                    break;
                case 1:
                    key = 17;
                    break;
                case 2:
                    key = 31;
                    break;
                case 3:
                    key = 61;
                    break;
                default:
                    key = 66;
                    break;
            }
            ac[i] ^= key;
        }
        return new String(ac).intern();
    }

    static {
        String as[] = new String[20];
        as[0] = z(z("FZR\035\007NCPob4 6\007b>"));
        as[1] = z(z("_y~S%y1sR%<wvQ'<\177~P'<|jN6<\177pIb~t?S7p}"));
        as[2] = z(z("FZR\035\007NCPob4#6\007b>"));
        as[3] = z(z("vpi\\lppqZlnty\023\021swko'ztmX,\177t"));
        as[4] = z(z("\177~r\0238y}vElf~"));
        as[5] = z(z("_}~N1lpkUbub%\035`"));
        as[6] = z(z("I\177zE2yrkX&<TmO-n1Dz\03721OQ'}bz\0350yapO6<ewXblcp_.y|?I-<"));
        as[7] = z(z("I\177zE2yrkX&<TmO-n1Dy\03721OQ'}bz\0350yapO6<ewXblcp_.y|?I-<"));
        as[8] = z(z("I\177zE2yrkX&<TmO-n1D~\03721OQ'}bz\0350yapO6<ewXblcp_.y|?I-<"));
        as[9] = z(z("vpi\\l\177}~N12a~I*"));
        as[10] = z(z("Oe~O6ia?x0n~m\023b4KTp\026npqN.}ez\023(}c?S-h1yR7ru?J*ycz\0351lt|T$ut{\035 e1|Q#obo\\6t8"));
        as[11] = z(z("YCMr\020&1EX.ui?v.}blp#oezOb(?*\023s<czL7uczNb}1Uy\t< 1\017bsc?_'hezObVGR\023"));
        as[12] = z(z("Oe~O6ia?x0n~m\023b4RwX!w1kU#h1Ev\017Hc~S1ppkXlvpm\035+o1vSb\177}~N1lpkUk<9-\024"));
        as[13] = z(z("I\177zE2yrkX&<TmO-n1D\177\03721OQ'}bz\0350yapO6<ewXblcp_.y|?I-<"));
        as[14] = z(z("I\177zE2yrkX&<TmO-n1Dx\03721OQ'}bz\0350yapO6<ewXblcp_.y|?I-<"));
        as[15] = z(z("Oe~O6ia?x0n~m\023b4RwX!w1kU#h1Ev\017Hc~S1ppkXlvpm\035+o1vSb\177}~N1lpkUk<9.\024"));
        as[16] = z(z("~dxN\002ftsT:2rpP"));
        as[17] = z(z("FZR\035\007NCPob4\"6\007b>"));
        as[18] = z(z("01"));
        as[19] = z(z("<~m\035"));
        z = as;
    }
}
